<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
  <title>谭明慧727-全运会看点</title>
  <style>
    /* 基础样式 */
    body {
      background-color: white;
      margin: 0;
      padding: 0;
      font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    }
    
    /* 工具类 */
    .tab-scrollbar-hide {
      -ms-overflow-style: none;
      scrollbar-width: none;
    }
    .tab-scrollbar-hide::-webkit-scrollbar {
      display: none;
    }
    
    /* 顶部Tab容器 */
    .sticky-header {
      position: sticky;
      top: 0;
      background-color: white;
      z-index: 10;
      border-bottom: 1px solid #e5e7eb;
    }
    
    .relative-container {
      position: relative;
    }
    
    /* 固定Tab样式 */
    .fixed-tab {
      position: fixed;
      left: 0;
      top: 0;
      z-index: 20;
      display: none;
      background-color: white;
      padding: 0.75rem 1rem;
      color: #1f2937;
      font-weight: 500;
      border-bottom: 2px solid white;
    }
    
    .fixed-tab::after {
      content: '';
      position: absolute;
      bottom: -0.25rem;
      left: 0;
      width: 100%;
      height: 0.25rem;
      background-color: white;
      border-top-left-radius: 0.375rem;
      border-top-right-radius: 0.375rem;
    }
    
    /* 红色背景容器 */
    .red-bg-container {
      background-color: #FF5757;
    }
    
    /* Tab滚动容器 */
    .tab-container {
      display: flex;
      gap: 0.75rem;
      overflow-x: auto;
      padding: 0.75rem 1rem;
    }
    
    /* Tab项样式 */
    .tab-item {
      background-color: #FF7170;
      border-radius: 0.5rem;
      padding: 0.5rem 1rem;
      position: relative;
      flex: 1;
      min-width: 100px;
      cursor: pointer;
      transition: all 0.3s;
    }
    
    .tab-item .triangle {
      position: absolute;
      /* 修改: 将三角形位置往下移动 */
      bottom: -0.5rem;
      left: 50%;
      transform: translateX(-50%);
      transition: all 0.3s;
    }
    
    .tab-item .triangle::after {
      content: '';
      display: block;
      width: 0;
      height: 0;
      border-left: 10px solid transparent;
      border-right: 10px solid transparent;
      border-top: 10px solid #FF7170;
    }
    
    .tab-item .tab-title {
      color: white;
      font-weight: 500;
      white-space: nowrap;
      text-align: center;
      transition: all 0.3s;
      /* 修改: 增大标题文字 */
      font-size: 1.5rem;
      /* 变细 */
      font-weight: 400;
    }
    
    .tab-item .tab-subtitle {
      font-size: 0.75rem;
      color: white;
      margin-top: 0.25rem;
      transition: all 0.3s;
    }
    
    /* 激活状态的Tab */
    .tab-item.active {
      background-color: white;
    }
    
    .tab-item.active .triangle::after {
      border-top-color: white;
    }
    
    .tab-item.active .tab-title {
      color: #ef4444;
    }
    
    /* 修改: 只有特定tab激活时主标题为黑色 */
    .tab-item[data-tab="全运会看点"].active .tab-title,
    .tab-item[data-tab="实时快讯"].active .tab-title {
      color: #1f2937; /* 黑色 */
    }
    
    /* 默认激活状态保持原来的灰色 */
    .tab-item.active .tab-subtitle {
      color: #6b7280;
    }
    
    /* 主内容区域 */
    .main-content {
      padding: 0;
    }
    
    /* 图片容器 */
    .image-container {
      width: 100%;
      height: 12rem;
      overflow: hidden;
    }
    
    .image-container img {
      width: 100%;
      height: 100%;
      object-fit: cover;
    }
    
    .image-caption {
      position: absolute;
      bottom: 0;
      left: 0;
      right: 0;
      background: linear-gradient(to top, rgba(0,0,0,0.7), transparent);
      padding: 0.75rem;
    }
    
    /* 内容区域通用样式 */
    .content-section {
      display: none;
      padding: 1rem;
    }
    
    .content-section.active {
      display: block;
    }
    
    .section-title {
      font-size: 1.5rem;
      font-weight: 700;
      margin-bottom: 0.75rem;
      font-weight: 400;
    }
    
    .space-y-2 > * + * {
      margin-top: 0.5rem;
    }
    
    .news-item {
      background-color: #f3f4f6;
      border-radius: 0.5rem;
      padding: 0.75rem;
    }
    
    .news-item p {
      color: #1f2937;
      margin: 0;
    }
    
    /* 最新动态区域 */
    .tag-container {
      display: flex;
      flex-wrap: wrap;
      gap: 0.5rem;
      margin-bottom: 0.75rem;
    }
    
    .tag {
      background-color: #ef4444;
      color: white;
      padding: 0.25rem 0.75rem;
      border-radius: 9999px;
      font-size: 0.875rem;
    }
    
    .tag-gray {
      background-color: #e5e7eb;
      color: #1f2937;
    }
    
    .relative-text {
      position: relative;
    }
    
    .timestamp {
      color: #6b7280;
      font-size: 0.875rem;
    }
    
    .share-button {
      position: absolute;
      right: 0;
      top: 0;
      background-color: #ef4444;
      color: white;
      padding: 0.5rem 1rem;
      border-radius: 9999px;
      display: flex;
      align-items: center;
      gap: 0.25rem;
      border: none;
      cursor: pointer;
      font-size: 0.875rem;
    }
    
    .share-button svg {
      width: 1rem;
      height: 1rem;
    }
  </style>
</head>
<body>
  <!-- 顶部 Tab 选项卡 -->
  <div class="sticky-header">
    <div class="relative-container">
      <!-- 固定的"全运会看点"Tab（滚动后固定） -->
      <div class="fixed-tab" id="fixedTab">
        全运会看点
      </div>
      <!-- 深红色背景容器，仅覆盖三个圆角矩形区域 -->
      <div class="red-bg-container">
        <!-- 可滚动 Tab 容器 -->
        <div class="tab-container tab-scrollbar-hide" id="tabContainer">
        <!-- 头条热榜：独立的浅红色圆角矩形 + 底部三角形 -->
        <div class="tab-item" data-tab="头条热榜">
          <div class="triangle"></div>
          <div class="tab-title">
            头条热榜
            <div class="tab-subtitle">实时更新</div>
          </div>
        </div>
        
        <!-- 全运会看点：独立的浅红色圆角矩形 + 底部三角形 -->
        <div class="tab-item active" data-tab="全运会看点">
          <div class="triangle"></div>
          <div class="tab-title">
            全运会看点
            <div class="tab-subtitle">郑钦文退赛</div>
          </div>
        </div>
        
        <!-- 实时快讯：独立的浅红色圆角矩形 + 底部三角形 -->
        <div class="tab-item" data-tab="实时快讯">
          <div class="triangle"></div>
          <div class="tab-title">
            实时快讯
            <div class="tab-subtitle">7×24小时</div>
          </div>
        </div>
      </div> <!-- 关闭红色背景容器 -->
    </div>
  </div>

  <!-- 主内容区域 -->
  <div class="main-content">
    <!-- 静态图片 -->
    <div class="image-container">
      <img src="img/image.png" alt="全运会精彩瞬间">

    </div>

    <!-- 1. 头条热榜内容 -->
    <div class="content-section" id="content-头条热榜">
      <h2 class="section-title">头条热榜</h2>
      
    </div>

    <!-- 2. 全运会看点内容 -->
    <div class="content-section active" id="content-全运会看点">
      <h2 class="section-title">焦点关注</h2>
      <div class="space-y-2">
        <div class="news-item">
          <p>• 全运会泳池"大战"再诞生四金</p>
        </div>
        <div class="news-item">
          <p>• 激情全运会 活力大湾区</p>
        </div>
        <div class="news-item">
          <p>• 郑钦文退出全运会</p>
        </div>
      </div>
    </div>

    <!-- 3. 实时快讯内容 -->
    <div class="content-section" id="content-实时快讯">
      <h2 class="section-title">实时快讯</h2>
  </div>

  <script>

    const tabContainer = document.getElementById('tabContainer');
    const fixedTab = document.getElementById('fixedTab');
    const targetTab = document.querySelectorAll('.tab-item')[1]; // 全运会看点Tab
    let targetOffset;

    // 初始化Tab尺寸
    function init() {
      targetOffset = targetTab.offsetLeft;
      fixedTab.style.width = `${targetTab.offsetWidth}px`;
      fixedTab.style.height = `${targetTab.offsetHeight}px`;
    }
    window.addEventListener('load', init);
    window.addEventListener('resize', init);

    // 滚动监听：固定"全运会看点"Tab
    tabContainer.addEventListener('scroll', () => {
      const currentScroll = tabContainer.scrollLeft;
      if (currentScroll >= targetOffset) {
        fixedTab.style.display = 'block';
        tabContainer.style.paddingLeft = `${fixedTab.offsetWidth}px`;
      } else {
        fixedTab.style.display = 'none';
        tabContainer.style.paddingLeft = '0';
      }
    });

    // Tab切换逻辑
    document.querySelectorAll('.tab-item').forEach(item => {
      item.addEventListener('click', () => {
        // 获取当前Tab名称
        const tabName = item.getAttribute('data-tab');
        
        // 重置所有Tab样式
        document.querySelectorAll('.tab-item').forEach(tab => {
          tab.classList.remove('active');
        });
        
        // 设置当前Tab样式
        item.classList.add('active');
        
        // 隐藏所有内容区域
        document.querySelectorAll('.content-section').forEach(section => {
          section.classList.remove('active');
        });
        
        // 显示对应内容区域
        const targetSection = document.getElementById(`content-${tabName}`);
        if (targetSection) {
          targetSection.classList.add('active');
        }
        
        // 控制图片显示逻辑
        const imageContainer = document.querySelector('.image-container');
        if (tabName === '全运会看点') {
          imageContainer.style.display = 'block';
        } else {
          imageContainer.style.display = 'none';
        }
      });
    });
  </script>
</body>
</html>
